package cn.bugstack.xfg.frame.domain.openapi.model.aggregates;

import cn.bugstack.xfg.frame.domain.openapi.model.entity.MessageEntity;
import cn.bugstack.xfg.frame.types.constants.Constants;
import cn.bugstack.xfg.frame.types.enums.ChatGPTModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.catalina.LifecycleState;

import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class ChatProcessAggregate {
    //  用户ID
    private String openid;
    // 默认模型
    private String model = ChatGPTModel.GPT_3_5_TURBO.getCode();
    // 问题描述
    private List<MessageEntity> messages;

    public boolean isWhiteList(String whiteListStr) {
        String[] whites = whiteListStr.split(Constants.SPLIT);
        for (String white : whites) {
            if (white.equals(openid)) {
                return true;
            }
        }
        return false;
    }
}
